package com.zx.chatroom.quartz;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import com.zx.chatroom.listener.BaseListener;
import com.zx.chatroom.listener.HallListener;

public class AutoOffline extends BaseListener {
	private static final Logger LOGGER = Logger.getLogger(AutoOffline.class);
	@Resource
	private Integer offlineTime;
	
	private boolean flag = true;
	/**
	 * 自动离线用户
	 */
	public void autoOffline(){
		try {
			if (flag) {
				flag = false;
				HallListener.getInstance().autoOffline(offlineTime);
			}
		} catch (Exception e) {
			LOGGER.error("自动离线任务会死："+e.getMessage());
		} finally {
			flag = true;
		}
	}
}
